<template>
	<view class="flex-column py-3 px-25"><task-item :list="list" @itemClick="itemClick"></task-item></view>
</template>

<script>
import taskItem from '../../../components/common/task-item.vue';
export default {
	components: { taskItem },
	data() {
		return {
			list:[]
		};
	},
	onPullDownRefresh() {
		this.getData()
	},
	onLoad() {
		this.getData()
	},
	methods: {
		itemClick(item){
			uni.setStorageSync('taskdetail',item);
			uni.navigateTo({
				url:'../../taskdetail/taskdetail'
			})
		},
		getData(){
			let this_ = this;
			let opts = {
				url: 'Jz/SearchJzZy.shtml'
			};
			let param = {
				longXsglId: uni.getStorageSync('classUserId')
			};
			this_.$http.httpRequest(opts, param).then(
				res => {
					console.log(res.data);
					if (res.data.code == '200') {
						uni.stopPullDownRefresh();
						this.list=res.data.data;
					} else {
						uni.showToast({
							icon: 'none',
							title: res.data.error.returnUserMessage
						});
					}
				},
				error => {
					console.log(error);
				}
			);
		}
	}
};
</script>

<style></style>
